package com.tencent.cloud.iov.common.util;

import android.content.Intent;
import android.support.annotation.StringRes;

import com.tencent.cloud.iov.common.constant.CommonIntentConst;
import com.tencent.cloud.iov.util.ResourcesUtils;

/**
 * @author showxiao
 * @date 2018/10/24
 */
public final class IntentUtils {

    private IntentUtils() {}

    public static void addBackTitle(Intent intent, @StringRes int backTitleRes) {
        addBackTitle(intent, ResourcesUtils.getString(backTitleRes));
    }

    public static void addBackTitle(Intent intent, String backTitle) {
        if (intent != null) {
            intent.putExtra(CommonIntentConst.KEY_BACK_TITLE, backTitle);
        }
    }

    public static String getBackTitle(Intent intent) {
        return intent != null ? intent.getStringExtra(CommonIntentConst.KEY_BACK_TITLE) : null;
    }

}
